package com.example.demo;

import org.springframework.util.StringUtils;

import java.util.Arrays;
import java.util.List;

public class Oauth2Req {
    private String clientId;
    private String responseType;
    private String scope;
    private String state;
    private String applicationName;
    private List scopeDescriptions;


    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }


    public String getResponseType() {
        return responseType;
    }

    public void setResponseType(String responseType) {
        this.responseType = responseType;
    }

    public String getScope() {
        return scope;
    }

    public void setScope(String scope) {
        this.scope = scope;
        if (StringUtils.hasText(this.scope)){
            String[] scopes = this.scope.split(" ");
            this.setScopeDescriptions(Arrays.asList(scopes));
        }
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getApplicationName() {
        return applicationName;
    }

    public void setApplicationName(String applicationName) {
        this.applicationName = applicationName;
    }

    public List getScopeDescriptions() {
        return scopeDescriptions;
    }

    public void setScopeDescriptions(List scopeDescriptions) {
        this.scopeDescriptions = scopeDescriptions;
    }
}
